﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>冲压件和材料定额对比</title>
     <link href="~/Content/css/StampingPartsAndMaterialQuotaCompare.css" rel="stylesheet" />
    <script type="text/javascript">
        $(function () {
            with (Index) {
                initTab({ c: $(".tab"), delay: 0, curClass: "tab_cur", content: $(".tab_contentc") });

                initControl();

                initData();
            }
        });

        var Index = {
            initTab: function (p) {
                p.c.on("click", function () {
                    var cur = $(this), other = cur.siblings();

                    other.removeClass(p.curClass);

                    cur.addClass(p.curClass);

                    p.content.animate({ scrollLeft: p.content.width() * cur.index() }, p.delay);
                });

                p.c.first().click();
            },
            initControl: function () {
                $('select').bindSelect();
                //生产单位数据
                $(".ProductUnit").bindSelect({
                    url: "/BaseData/ZSJ_B1_GH_SI/GetProduceUnit",
                    id: "MakeLineNO",
                    text: "MakeLineNOName"
                });

                $("#butnSearch1").on("click", function () {
                    var $gridList1 = $("#gridList1");

                    var conn1 = {
                        ManufactureLine: $("#ManufactureLine1").val(),
                        ProduceLine: $("#ProduceLine1").val(),
                        ProductUnit: $("#ProductUnit1").val(),
                        ProduWorkshop: $("#ProduWorkshop1").val(),
                        FProductionNO: $("#FProductionNO1").val(),
                        Material: "",
                        FSign: 0
                    };

                    $gridList1.jqGrid('setGridParam', {
                        postData: conn1,
                    }).trigger('reloadGrid');
                });

                $("#butnSearch2").on("click", function () {
                    var $gridList2 = $("#gridList2");

                    var conn2 = {
                        ManufactureLine: $("#ManufactureLine2").val(),
                        ProduceLine: $("#ProduceLine2").val(),
                        ProductUnit: $("#ProductUnit2").val(),
                        ProduWorkshop: $("#ProduWorkshop2").val(),
                        FProductionNO: "",
                        Material: $("#Material2").val(),
                        FSign: 1
                    };

                    $gridList2.jqGrid('setGridParam', {
                        postData: conn2,
                    }).trigger('reloadGrid');
                });

                $("#butnCheck1").on("click", function () {
                    $.loading(true, "正在检查中。。。请稍后！");
                    $.post("/VBaseData/V_CPK_A1_BB_StoProStockCata_RB/GetGridJsonMateQutoCheckDo", { FSign: 0 }, function (res) {
                        $.loading(false);

                        0 < res && (function (count) {
                            console.log("检查成功导入{0}个问题零件".format(count));

                            $("#butnSearch1").trigger("click");
                        })(res);
                    }, "json");
                });

                $("#butnCheck2").on("click", function () {
                    $.loading(true, "正在检查中。。。请稍后！");
                    $.post("/VBaseData/V_CPK_A1_BB_StoProStockCata_RB/GetGridJsonMateQutoCheckDo", { FSign: 1 }, function (res) {
                        $.loading(false);

                        0 < res && (function (count) {
                            console.log("检查成功导入{0}条申报定额".format(count));

                            $("#butnSearch2").trigger("click");
                        })(res);
                    }, "json");
                });

            },
            initData: function () {
                var conn1 = {
                    ManufactureLine: $("#ManufactureLine1").val(),
                    ProduceLine:$("#ProduceLine1").val(),
                    ProductUnit: $("#ProductUnit1").val(),
                    ProduWorkshop: $("#ProduWorkshop1").val(),
                    FProductionNO: $("#FProductionNO1").val(),
                    Material:"",
                    FSign:0
                };

                var $gridList1 = $("#gridList1");
                $gridList1.dataGridForJson({
                    url: "/VBaseData/V_CPK_A1_BB_StoProStockCata_RB/GetGridJsonMateQutoCheck",
                    postData: conn1,
                    height: $(window).height() - 225,
                    colModel: [
                         { label: "零部件号", name: 'FProductionNO', width: 120, align: 'left', },
                        { label: '零件名称', name: 'FProductionName', width: 160, align: 'left', },
                        { label: '装配路线', name: 'AssembleLine', width: 120, align: 'left' },
                        { label: '制造路线', name: 'MakeLine', width: 120, align: 'left' },
                         { label: '生产单位', name: 'productUnitName', width: 120, align: 'left' },
                        { label: '生产车间', name: 'ProduWorkshopName', width: 160, align: 'left' },
                        { label: '问题说明', name: 'ProblemDes', width: 450, align: 'left' },
                         { label: ' ', name: ' ', width: ($(window).width() - 1380), align: 'left', sortable: false }
                    ],
                    pager: "#gridPager1",
                    sortname: 'ProblemID asc',
                    viewrecords: true,
                    rownumWidth: 50,
                    onSelectRow: function (rowId) {
                        rowData = $gridList1.jqGrid('getRowData', rowId);
                        index = rowId;
                        $.each(rowData, function (key, value) {
                            $("#txt" + key).val(value);
                        });
                    }
                });
                var conn2 = {
                    ManufactureLine: $("#ManufactureLine2").val(),
                    ProduceLine: $("#ProduceLine2").val(),
                    ProductUnit: $("#ProductUnit2").val(),
                    ProduWorkshop: $("#ProduWorkshop2").val(),
                    FProductionNO: "",
                    Material: $("#Material2").val(),
                    FSign: 1
                };

                $gridList1.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');

                var $gridList2 = $("#gridList2");
                $gridList2.dataGridForJson({
                    url: "/VBaseData/V_CPK_A1_BB_StoProStockCata_RB/GetGridJsonMateQutoCheck",
                    postData: conn2,
                    height: $(window).height() - 225,
                    colModel: [
                        { label: "零部件号", name: 'FProductionNO', width: 120, align: 'left', },
                        { label: '零件名称', name: 'FProductionName', width: 160, align: 'left', },
                        { label: '装配路线', name: 'AssembleLine', width: 120, align: 'left' },
                        { label: '制造路线', name: 'MakeLine', width: 120, align: 'left' },
                         { label: '生产单位', name: 'ProductUnit', width: 120, align: 'left' },
                        { label: '生产车间', name: 'ProduWorkshopName', width: 160, align: 'left' },
                        { label: '问题说明', name: 'ProblemDes', width: 450, align: 'left' },
                          { label: ' ', name: ' ', width: ($(window).width() - 1380), align: 'left', sortable: false }
                    ],
                    pager: "#gridPager2",
                    sortname: 'ProblemID asc',
                    viewrecords: true,
                    rownumWidth: 50,
                    onSelectRow: function (rowId) {
                        rowData = $gridList2.jqGrid('getRowData', rowId);
                        index = rowId;
                        $.each(rowData, function (key, value) {
                            $("#txt" + key).val(value);
                        });
                    }
                });
                $gridList2.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
            }
        };

    </script>

</head>
<body>
    <div id="wrapper">
        <div class="c_container">
            <ul class="tabs">
                <li class="tab tab_cur">问题零件
                </li>
                <li class="tab">申报定额
                </li>
                <li class="clear"></li>
            </ul>
            <div class="tab_contentc">
                <ul class="tab_contents">
                    <li class="tab_content">
                        <header>
                            
                            <div class="f_l">
                                <div class="input_area">
                                    <h2 class="input_title">装配路线</h2>
                                    <div class="input_c input_c_no input_c_w15">
                                         <select id="ManufactureLine1" class="sel_common  ProductUnit">
                                            <option value="">--请选择--</option>
                                        </select>
                                    </div> 
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">制造路线</h2>
                                    <div class="input_c input_c_w15">
                                          <input id="ProduceLine1" class="txt_common" />
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">生产单位</h2>
                                    <div class="input_c input_c_no input_c_w12">
                                        <select id="ProductUnit1" class="sel_common ProductUnit">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">生产车间</h2>
                                    <div class="input_c input_c_no input_c_w15">
                                        <select id="ProduWorkshop1" class="sel_common ProductUnit">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                                 <div class="input_area">
                                    <h2 class="input_title">零部件号</h2>
                                    <div class="input_c input_c_w12">
                                        <input id="FProductionNO1" type="text" class="txt_common" />
                                    </div>
                                </div>
                            </div>
                            <div class="f_r">
                                <button id="butnSearch1" class="butn_common">
                                    <span class="glyphicon glyphicon-search"></span>查询
                                </button>
                                <button id="butnCheck1" class="butn_common">
                                    <span class="glyphicon glyphicon-check"></span>检查
                                </button>
                                <button class="butn_common">
                                    <span class="glyphicon glyphicon-trash"></span>删除
                                </button>
                                <button class="butn_common">
                                    <span class="glyphicon glyphicon-download"></span>导出
                                </button>
                            </div>
                        </header>
                        <div class="table_c">
                            <table id="gridList1"></table>
                            <div id="gridPager1"></div>
                        </div>
                    </li>
                    <li class="tab_content">
                        <header>
                            <div class="f_l">
                                <div class="input_area">
                                    <h2 class="input_title">装配路线</h2>
                                    <div class="input_c input_c_no input_c_w15">
                                          <select id="ManufactureLine2" class="sel_common ProductUnit">
                                            <option value="">--请选择--</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">制造路线</h2>
                                    <div class="input_c input_c_w15">
                                          <input id="ProduceLine2" class="txt_common" />
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">生产单位</h2>
                                    <div class="input_c input_c_no input_c_w12">
                                        <select id="ProductUnit2" class="sel_common ProductUnit">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">生产车间</h2>
                                    <div class="input_c input_c_no input_c_w15">
                                        <select id="ProduWorkshop2" class="sel_common ProductUnit">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="input_area">
                                    <h2 class="input_title">材料号</h2>
                                    <div class="input_c input_c_w12">
                                        <input id="Material2" type="text" class="txt_common" />
                                    </div>
                                </div>
                            </div>
                                  <div class="f_r">
                                <button id="butnSearch2" class="butn_common">
                                    <span class="glyphicon glyphicon-search"></span>查询
                                </button>
                                <button  id="butnCheck2" class="butn_common">
                                    <span class="glyphicon glyphicon-check"></span>检查
                                </button>
                                <button class="butn_common">
                                    <span class="glyphicon glyphicon-trash"></span>删除
                                </button>
                                <button class="butn_common">
                                    <span class="glyphicon glyphicon-download"></span>导出
                                </button>
                            </div>
                        </header>
                        <div class="table_c">
                            <table id="gridList2"></table>
                            <div id="gridPager2"></div>
                        </div>
                    </li>
                </ul>

            </div>
        </div>
    </div>
</body>
</html>




